package de.preissler.selection;

import java.util.List;

public class ChangeOfISIN implements Comparable<ChangeOfISIN>
{
	public final List<String> isins;
	public final double change;
	
	public ChangeOfISIN(double change, List<String> isins)
	{
		this.isins = isins;
		this.change = change;
	}
	
	public String toString()
	{
		return isins.toString() + " : " + change;
		
	}

	public int compareTo(ChangeOfISIN o)
	{
		if(o == null)
			throw new NullPointerException();
		
		if(o.change == this.change)
			return 0;
		
		if(this.change > o.change)
			return 1;
		else
			return -1;
	}
	
	public boolean equals(Object o)
	{
		if(o == null)
			return false;
		
		if(o instanceof ChangeOfISIN)
		{
			ChangeOfISIN c = (ChangeOfISIN)o;
			if(c.change == this.change)
				return true;
			else
				return false;
		}
		else
			return false;
	}
	
}
